package com.furb.topicos;



import com.bancoDados.DataBaseHelper;
import com.furb.topicos.R;

import android.app.Activity;
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class lembrete extends Activity {
	
	private EditText edDescricao;
	private EditText edPessoa;
	private EditText edData;
	private Button  btnCadastra;
	
	private DataBaseHelper helper;
	
	@Override
    protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.lembrete);
		
		edDescricao = (EditText) findViewById(R.id.ed_lembrete_descricao);
		edPessoa = (EditText) findViewById(R.id.ed_lembrete_pessoa);
		edData = (EditText) findViewById(R.id.ed_lembrete_data);
		btnCadastra = (Button) findViewById(R.id.btn_lembrete_cadastro);
		
		helper = new DataBaseHelper(lembrete.this);
		
		
		btnCadastra.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				SQLiteDatabase db = helper.getWritableDatabase();
				ContentValues values = new ContentValues();
				values.put("assunto", "");
				values.put("descricao", edDescricao.getText().toString());
				values.put("local", "");
				values.put("pessoa", edPessoa.getText().toString());
				values.put("data", edData.getText().toString());
				values.put("foto", "");
				db.insert("tLembrete", null, values);
				Toast.makeText(lembrete.this, "Lembrete cadastrado com sucesso!", Toast.LENGTH_SHORT).show();
				
				finish();
			}
		});
	}

	

}
